/**
 * 行业工具类
 * 封装行业样式、图标、颜色等相关方法
 */

/**
 * 获取行业对应的图标
 * @param {String} industry 行业名称
 * @returns {String} 图标名称
 */
export function getIndustryIcon(industry) {
  const iconMap = {
    政府机构: "zhihu-circle-fill",
    党政: "zhihu-circle-fill",
    教育: "bookmark",
    科教: "bookmark",
    医疗: "heart",
    医卫: "heart",
    金融: "rmb-circle",
    交通: "car",
    工业能源: "setting",
    农商: "shopping-cart",
    创新: "star",
    融合: "reload",
    公检法: "shield"
  };

  return iconMap[industry] || "grid";
}

/**
 * 获取行业对应的颜色
 * @param {String} industry 行业名称
 * @returns {String} 颜色值
 */
export function getIndustryColor(industry) {
  const colorMap = {
    政府机构: "#19be6b",
    党政: "#19be6b",
    教育: "#ff9900",
    科教: "#ff9900",
    医疗: "#f56c6c",
    医卫: "#f56c6c",
    金融: "#9c26b0",
    交通: "#3498db",
    工业能源: "#e67e22",
    农商: "#2ecc71",
    创新: "#1abc9c",
    融合: "#34495e",
    公检法: "#8e44ad"
  };

  return colorMap[industry] || "#909399";
}

/**
 * 获取行业对应的CSS类名（筛选标签用）
 * @param {String} industry 行业名称
 * @returns {String} CSS类名
 */
export function getIndustryTagClass(industry) {
  const classMap = {
    政府机构: "tag-government",
    党政: "tag-government",
    教育: "tag-education",
    科教: "tag-education",
    医疗: "tag-medical",
    医卫: "tag-medical",
    金融: "tag-finance",
    交通: "tag-transport",
    工业能源: "tag-industry",
    农商: "tag-agriculture",
    创新: "tag-innovation",
    融合: "tag-fusion",
    公检法: "tag-legal"
  };

  return classMap[industry] || "tag-default";
}

/**
 * 获取行业对应的头像样式类
 * @param {String} industry 行业名称
 * @returns {String} CSS类名
 */
export function getIndustryAvatarClass(industry) {
  switch (industry) {
    case "政府机构":
    case "党政":
      return "avatar-government";
    case "教育":
    case "科教":
      return "avatar-education";
    case "医疗":
    case "医卫":
      return "avatar-medical";
    case "金融":
      return "avatar-finance";
    case "交通":
      return "avatar-transport";
    case "工业能源":
      return "avatar-industry";
    case "农商":
      return "avatar-agriculture";
    case "创新":
      return "avatar-innovation";
    case "融合":
      return "avatar-fusion";
    case "公检法":
      return "avatar-legal";
    default:
      return "avatar-default";
  }
}

/**
 * 获取行业对应的徽章样式类
 * @param {String} industry 行业名称
 * @returns {String} CSS类名
 */
export function getIndustryBadgeClass(industry) {
  if (!industry) return "badge-default";

  switch (industry) {
    case "政府机构":
    case "党政":
      return "badge-government";
    case "教育":
    case "科教":
      return "badge-education";
    case "医疗":
    case "医卫":
      return "badge-medical";
    case "金融":
      return "badge-finance";
    case "交通":
      return "badge-transport";
    case "工业能源":
      return "badge-industry";
    case "农商":
      return "badge-agriculture";
    case "创新":
      return "badge-innovation";
    case "融合":
      return "badge-fusion";
    case "公检法":
      return "badge-legal";
    default:
      return "badge-default";
  }
}

/**
 * 获取本网份额对应的样式类
 * @param {Number} share 本网份额（百分比）
 * @returns {String} CSS类名
 */
export function getNetworkShareClass(share) {
  if (!share && share !== 0) return "share-default";

  if (share < 40) return "share-low";
  if (share < 60) return "share-medium";
  return "share-high";
}

/**
 * 获取产品类型样式
 * @param {String} type 产品类型
 * @returns {String} CSS类名
 */
export function getProductTypeClass(type) {
  switch (type) {
    case "专线":
      return "type-line";
    case "移动云":
      return "type-cloud";
    case "物联网":
      return "type-iot";
    case "短彩信":
      return "type-sms";
    default:
      return "type-other";
  }
}

/**
 * 获取状态样式
 * @param {String} status 状态名称
 * @returns {String} CSS类名
 */
export function getStatusClass(status) {
  switch (status) {
    case "跟进中":
      return "status-following";
    case "已落地":
      return "status-done";
    case "废弃":
      return "status-discard";
    default:
      return "";
  }
} 